package com.suning.sawp.service.impl.dao;

import javax.annotation.Resource;

import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

import com.suning.sawp.intf.dao.StoreInfoDaoService;
import com.suning.sawp.po.store.StoreInfo;

@Service("storeInfoDaoService")
public class StoreInfoDaoServiceImpl implements StoreInfoDaoService {

    @Resource
    MongoOperations mongoTemplate;
    
    @Override
    public StoreInfo queryStoreInfoByStoreCode(String storeCode) {
        Query query = new Query();
        Criteria criteria = new Criteria();
        criteria.and(StoreInfo.StoreAttributes.STORE_CODE).is(storeCode);
        query.addCriteria(criteria);
        
        return mongoTemplate.findOne(query, StoreInfo.class);
    }

}
